<?php 
	include('../Modele/connexion_bdd.php'); 

	//On détermine si un pseudo est libre ou non
	if(isset($_GET['pseudo'])) {
		$pseudo = $_GET['pseudo'];
	} else if(isset($_POST['pseudo'])) {
		$pseudo = $_POST['pseudo'];
	}
		
	$req1 = $bdd->query('SELECT pseudo FROM utilisateur WHERE pseudo="'.$pseudo.'"');
	$test1 = $req1->fetch();
		
	$req2 = $bdd->query('SELECT pseudo FROM organisateur WHERE pseudo="'.$pseudo.'"');
	$test2 = $req2->fetch();
	
	if($test1 || $test2) {
		if(isset($_GET['pseudo'])) {
			echo "non libre";
		} else {
			$reponse = false;
		}
	} else {
		if(isset($_GET['pseudo'])) {
			echo "libre";
		} else {
			$reponse = true;
		}
	}
	
	$req1->closeCursor();
	$req2->closeCursor();
?>